<template>
  <div class="header">
    <div class="title">
      <span>智能网联汽车大数据</span>
      <span>运控基础平台</span>
    </div>
    <div class="left">
      <slot></slot>
    </div>
    <div class="right">
      <span class="yanpan" @click="skipToAnalysisPage">{{carPage?'数据洞察':'数据研判'}}</span>
      <span v-if="showCarBtn" class="yanpan" @click="skipToCarPage">车辆详情</span>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';

const props = defineProps({
  carPage: {
    type: Boolean,
    default: false
  },
  showCarBtn:{
    type: Boolean,
    default: false
  }
});

const skipToAnalysisPage = () => {
  window.open(props.carPage?window.g.synergyUrl:window.g.situationUrl, '_blank');
};

const skipToCarPage = () =>{
  window.open(window.location.origin + '/#/Car', '_blank');
}
</script>
<style lang="less" scoped>
.header {
  width: 100%;
  height: var(--headerHeight);
  background-image: url("@/assets/images/header.png");
  display: flex;
  // align-items: center;
  justify-content: space-between;
  background-size: 100% 100%;
  font-weight: 400;
  color: #ffffff;
  z-index: 10;
  padding: 0 1.5rem;
  position: absolute;
  .yanpan {
    width: 7.5rem;
    height: 2.125rem;
    line-height: 2.125rem;
    // box-shadow: 0px 0px 0.25rem 1px #585292;
    box-shadow: 0px 0px 0.25rem 1px #585292, inset 0px 0px 0.625rem 1px #0f16a5;
    border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
    font-size: 1rem;
    opacity: 1;
    cursor: pointer;
    z-index: 100;
  }
  .left {
    width: 25%;
    height: 3.625rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    z-index: 20;
  }

  .right {
    position: absolute;
    top: 0;
    right: 0;
    width: 25%;
    height: 3.625rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    z-index: 20;
    padding-right: 1rem;
    gap: 0.75rem;
  }
  .title {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fcfeff;
    letter-spacing: 0.5rem;
    text-shadow: 0px 3px 3px rgba(255, 255, 255, 0.21);
    font-size: 1.625rem;
    font-family: PingFang SC-Semibold, PingFang SC;
    position: absolute;
    left: 0;
    top: 0;
    flex-direction: column;
    z-index: 11;
  }
}
</style>
